package shopping.demo.code;

public enum ResponseCode {
    /*
    登陆操作
     */
    LOGIN_SUCCESS(100,"登陆成功"),
    LOGIN_FAIL(101,"账号或者密码错误"),
    LOGOUT_SUCCESS(200,"退出成功"),
    NO_PERMISSION(401,"没有权限"),
    UNKNOWN(500,"服务器出现未知错误"),

    /*
    用户操作
     */
    USER_SCCUESS(1000,"用户操作成功"),
    USER_EXIST(1001,"用户已存在"),
    USER_NOTEXIST(1002,"用户不存在"),

    /*
    商品操作
     */
    GOODS_SUCCESS(2000,"商品操作成功"),
    GOODS_EXIST(2001,"商品已存在，请重新输入"),
    GOODS_NOTEXIST(2002,"商品不存在，请查询后再进行操作"),
    GOODS_NOTVALID(2003,"商品信息格式错误，请重新输入"),
    /*
    订单操作
     */
    ORDER_SUCCESS(3000,"订单操作成功"),
    ORDER_COMMIT_FAIL_STATUS(3001,"提交订单失败，该订单状态不支持操作"),
    ORDER_COMMIT_FAIL_COUNT(3002,"提交订单失败，商品库存不足"),
    ORDER_COMMIT_FAIL_MONEY(3003,"提交订单失败，用户余额不足"),
    ORDER_DELETE_FAIL(3004,"删除订单失败"),
    ORDER_EXIST(3005,"订单已存在"),
    ORDER_NOTEXIST(3006,"订单不存在"),

    /*
    token操作
     */
    TOKEN_NOTVALID(4001,"请勿违规操作"),
    TOKEN_NOTEXIST(4002,"请勿重复操作");

    private Integer code;
    private String msg;

    ResponseCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
